package tests;

import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.RenderingHints;

import javax.swing.JPanel;

@SuppressWarnings("serial")
public class MyPanel extends JPanel {
	public Image image;
	public MyPanel(){
		this.setBackground(Color.WHITE);
		
		repaint();
	}
	protected void paintComponent(Graphics g) {
		super.paintComponent( g );
		if (image == null)
            image = createImage(getWidth(), getHeight()); //Width and Height are fields in class
        Graphics2D g2d = (Graphics2D)image.getGraphics();
        g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,     RenderingHints.VALUE_ANTIALIAS_ON);
 
        g.drawImage(image, 0,0, getWidth(), getHeight(), null);
			
	}
}
